<p class="Paragraph">FileNumber: Any integer expression that determines the file number.</p>
<p class="Paragraph">Position: For files opened in Random mode, <span class="T1">Position</span> is the number of the record to be read.</p>
<p class="Paragraph">For files opened in Binary mode, <span class="T1">Position</span> is the byte position within the file where reading starts.</p>
<p class="Paragraph">If <span class="T1">Position</span> is omitted, the current position or the current data record of the file is used.</p>
<p class="Paragraph">Variable: Name of the variable to be read. With the exception of object variables, any variable type can be used.</p>
<p class="P2">Example:</p>
<p class="PropText">Sub ExampleRandomAccess</p>
<p class="PropText">Dim iNumber As Integer</p>
<p class="PropText">Dim sText As Variant REM Must be a variant</p>
<p class="PropText">Dim aFile As String</p>
<p class="PropText">aFile = "c:\data.txt"</p>
<p class="PropText"/>
<p class="PropText">iNumber = Freefile</p>
<p class="PropText">Open aFile For Random As #iNumber Len=32</p>
<p class="PropText">Seek #iNumber,1 <text:s text:c="2" xmlns:text="http://openoffice.org/2000/text"/>REM Position at beginning</p>
<p class="PropText">Put #iNumber,, "This is the first line of text" <text:s text:c="" xmlns:text="http://openoffice.org/2000/text"/>REM Fill line with text</p>
<p class="PropText">Put #iNumber,, "This is the second line of text"</p>
<p class="PropText">Put #iNumber,, "This is the third line of text"</p>
<p class="PropText">Seek #iNumber,2</p>
<p class="PropText">Get #iNumber,,sText</p>
<p class="PropText">Print sText</p>
<p class="PropText">Close #iNumber</p>
<p class="PropText"/>
<p class="PropText">iNumber = Freefile</p>
<p class="PropText">Open aFile For Random As #iNumber Len=32</p>
<p class="PropText">Get #iNumber,2,sText</p>
<p class="PropText">Put #iNumber,,"This is a new text"</p>
<p class="PropText">Get #iNumber,1,sText</p>
<p class="PropText">Get #iNumber,2,sText</p>
<p class="PropText">Put #iNumber,20,"This is the text in record 20"</p>